<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./lib/vue-2.4.0.js"></script>
  <script src="./lib/axios.js"></script>
</head>
<body>
  <div id="app">

  </div>
  <script>
    axios.defaults.baseURL ="http://www.liulongbin.top:3005"
    new Vue({
      el:'#app',

      methods:{
        getMsg(){
          // 如果是通过get请求传参要注意  对象里面必须包裹一层 ,{params:{name:''}}
          axios.get('api/getprodlist').then(res=>{
            console.log(res.data.message)
          })
        },
        postMsg(){
          // 如果是post传参 还是老样子，不需要修改什么
          // axios 默认没有提供jsonp
          axios.post('api/addproduct',{name:'123'}).then(res=>{
            console.log(res)
          })
        }
      },
      created(){
        this.getMsg()
        this.postMsg()
      }

    })
  </script>
</body>
</html>